<?php
require("../connect/connect.php");

$tipo = $_GET["tipo"];

if (isset($_SESSION["profile"]) && $_SESSION["profile"] == 2){
	$id = $_GET["id"];

	$query = "UPDATE utilizadores_tbl SET tipo='".$tipo."'
		WHERE id='". $id ."'";

	$result = $conn->query($query);

	$query = "UPDATE equipas_tbl SET ativo='".$tipo."'
		WHERE id='". $id ."'";

	$result = $conn->query($query);


	echo $conn->error;

	if (!$result)
		header("location: ../publico/index.php");
	header("location: ../publico/listTeams.php");
}

?>